#ifndef PATIENT_CHATLISTWIDGET_H
#define PATIENT_CHATLISTWIDGET_H

#include <QWidget>
#include <QList>
#include "../../../Common/models.h"
#include "../../../Common/protocol.h"

namespace Ui {
class PatientChatListWidget;
}

class PatientChatListWidget : public QWidget
{
    Q_OBJECT

public:
    explicit PatientChatListWidget(int patientId, QWidget *parent = nullptr);
    ~PatientChatListWidget();

private slots:
    void on_departmentCombo_currentIndexChanged(int index);
    void on_clinicTypeCombo_currentIndexChanged(int index);
    void on_searchButton_clicked();
    void onMessageReceived(MessageType type, const QJsonObject& data);
    void on_doctorTable_cellDoubleClicked(int row, int column);
    void onChatButtonClicked();

private:
    Ui::PatientChatListWidget *ui;
    int m_patientId;
    QList<Doctor> m_doctors;
    
    void loadDepartments();
    void loadDoctors();
    void updateDoctorTable();
    void filterDoctors();
    void showDoctorDetail(int doctorId);
    void openChatWindow(int doctorId, const QString& doctorName);
};

#endif // PATIENT_CHATLISTWIDGET_H

